Function Reference

_IEDocWriteHTML

Replaces the HTML for the entire document.

#include <IE.au3>
_IEDocWriteHTML ( ByRef $o_object, $s_html )

 

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object
$s_html The HTML string to write to the document

 

Return Value

Success: Returns -1
Failure: Returns 0 and sets @ERROR
@Error: 0 ($_IEStatus_Success) = No Error
1 ($_IEStatus_GeneralError) = General Error
3 ($_IEStatus_InvalidDataType) = Invalid Data Type
4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
8 ($_IEStatus_AccessIsDenied) = Access Is Denied
@Extended: Contains invalid parameter number

 

Remarks

This function completely replaces the content of the document in a browser or a frame. It can be used to create a new page with custom HTML and JavaScript.

It is sometimes necessary to refresh the page after writing with _IEAction($oIE, "refresh") (e,g, after creating a FRAMESET).

 

Related

_IEDocReadHTML

 

Example


; *******************************************************
; Example 1 - Create an empty browser, write customer HTML to it - in this case a
;               FRAMESET - and then update the contents of each of the frames
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ()
$sHTML = ""
$sHTML &= "<HTML>" & @CR
$sHTML &= "<HEAD>" & @CR
$sHTML &= "<TITLE>_IE_Example('frameset')</TITLE>" & @CR
$sHTML &= "</HEAD>" & @CR
$sHTML &= "<FRAMESET rows='25,200'>" & @CR
$sHTML &= " <FRAME NAME=Top src=about:blank>" & @CR
$sHTML &= " <FRAMESET cols='100,500'>" & @CR
$sHTML &= "   <FRAME NAME=Menu src=about:blank>" & @CR
$sHTML &= "   <FRAME NAME=Main src=about:blank>" & @CR
$sHTML &= " </FRAMESET>" & @CR
$sHTML &= "</FRAMESET>" & @CR
$sHTML &= "</HTML>"
_IEDocWriteHTML ($oIE, $sHTML)
_IEAction ($oIE, "refresh")
Local $oFrameTop = _IEFrameGetObjByName ($oIE, "Top")
Local $oFrameMenu = _IEFrameGetObjByName ($oIE, "Menu")
Local $oFrameMain = _IEFrameGetObjByName ($oIE, "Main")
_IEBodyWriteHTML ($oFrameTop, '$oFrameTop = _IEFrameGetObjByName($oIE, "Top")')
_IEBodyWriteHTML ($oFrameMenu, '$oFrameMenu = _IEFrameGetObjByName($oIE, "Menu")')
_IEBodyWriteHTML ($oFrameMain, '$oFrameMain = _IEFrameGetObjByName($oIE, "Main")')